package reflecct;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @classname:aMethod
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/23 22:14
 * @version: 0.1
 * @since:1.8
 */
public class aMethod {
    public static void main(String[] args) {
        a();
    }

    private static void a() {

        try {
            Class<?> aClass = Class.forName("reflecct.User");
            User user = (User) aClass.newInstance();
            Method method = aClass.getDeclaredMethod("ww", String.class, Integer.class);
            method.setAccessible(true);
            String result = (String) method.invoke(user, "是的撒多", 100);
            System.out.println(result);


        } catch (ClassNotFoundException|IllegalAccessException|InstantiationException|NoSuchMethodException|InvocationTargetException e) {
            e.printStackTrace();
        }


    }
}
